extends Node

# 长度为4，每个元素代表一个星期所要进行的活动
var week_anpai = []
# 一个月4个周，每周要进行的活动
var week1
var week2
var week3
var week4
# 别删
var current_edit_week = 0

onready var work_icon = preload("res://resource/work.tres")
onready var gedou_icon = preload("res://resource/gedou_icon.tres")
onready var magic_icon = preload("res://resource/magic.tres")
onready var wenxue_icon = preload("res://resource/wenxue.tres")
onready var music_icon = preload("res://resource/music.tres")
onready var reset_icon = preload("res://resource/reset.tres")

onready var magic_class_icon = preload("res://assets/class_work/class_5s.png")
onready var gedou_class_icon = preload("res://assets/class_work/class_1s.png")
onready var wenxue_class_icon = preload("res://assets/class_work/class_9s.png")
onready var music_class_icon = preload("res://assets/class_work/class_13s.png")

var data = {
	"age":13,
	"year":1,
	"month":1,
	"coin":1000,#1000 初始
	"tixing":"小人",
	"zhili":0,
	"shenli":0,
	"qizhi":0,
	"tili":60,
	"pilao":0,
	"unlock_endcg_small":false,
	"unlock_endcg_c":false,
	"unlock_endcg_b":false,
	"unlock_endcg_s":false,
	"end":false
}
func add_each_week_to_list():
	if week_anpai.size() > 0:
		week_anpai.clear()
	week_anpai.append(week1)
	week_anpai.append(week2)
	week_anpai.append(week3)
	week_anpai.append(week4)
	print_debug("本月安排",week_anpai)
	
func on_week_update(type):
	if current_edit_week == 0:
		week1 = type
	elif current_edit_week ==1:
		week2 = type
	elif current_edit_week ==2:
		week3 = type
	elif current_edit_week == 3:
		week4 = type
func save():
	var file = File.new()
	file.open("user://data.json",File.WRITE_READ)
	file.store_string(to_json(data))
	file.close()
func clear_data():
	var dir = Directory.new()
	dir.open("user://")
	dir.remove("data.json")
	data = {
	"age":13,
	"year":1,
	"month":1,
	"coin":1000,#1000 初始
	"tixing":"小人",
	"zhili":0,
	"shenli":0,
	"qizhi":0,
	"tili":60,
	"pilao":0,
	"end":false
}
	
